#ifndef CONTAINER_RIFF_H_
#define CONTAINER_RIFF_H_

#include <nds.h>
#include <string>
#include "audioreader.h"

struct ContainerRIFFChunk
{
	std::string ckID;
	std::string ckType;
	uint32_t ckSize;
	uint32_t ckPos;
	uint32_t ckStart;
};

class ContainerRIFF {
	public:
		bool init(std::string filepath);
		void rewind();
		
		bool nextChunk();
		ContainerRIFFChunk getChunkHead();
		void readChunkData(char *data, uint32_t len);
		uint32_t getChunkRemLen();
		
		bool nextSubChunk();
		ContainerRIFFChunk getSubChunkHead();
		void readSubChunkData(char *data, uint32_t len);
	
	private:
		uint32_t riffSize;
		AudioReader reader;

		ContainerRIFFChunk chData;
		ContainerRIFFChunk subchData;
};

#endif /* CONTAINER_RIFF_H_ */

